Skip to content

chore: tune buffer output limit#68

Merged
phasetr merged 2 commits into
mainfrom
feat/tune-buffer-output-limit
May 13, 2026
Merged

chore: tune buffer output limit#68
phasetr merged 2 commits into
mainfrom
feat/tune-buffer-output-limit

Conversation

@phasetr
Copy link
Copy Markdown
Owner

@phasetr phasetr commented May 13, 2026

Summary

  • Start discussion for tuning buffer output limits to preserve longer proposals while keeping load controlled.

Notes

  • Empty initial commit as requested before implementation.

Test plan

  • Not run yet; specification and implementation are pending.

@phasetr
Copy link
Copy Markdown
Owner Author

phasetr commented May 13, 2026

Specification discussion note

Current behavior:

  • The tmux mirror runs capture-pane -p -J -S -<lines> asynchronously, then replaces the read-only mirror buffer with the returned content.
  • Auto-refresh is disabled by default. Hidden mirrors skip refresh. The main paths are explicit refresh and forced refresh on notifications.
  • Current limits are history-lines=160, display-lines=80, max-chars=64KiB, max-line-length=240, with noisy block compaction enabled.

Problem:

  • Longer specification proposals often lose the beginning when only the final 80 lines / 64KiB tail is shown.
  • Because capture-pane -J joins wrapped lines, normal long prose can become a line longer than 240 chars and may be truncated.

Proposed defaults:

  • enkan-repl-tmux-mirror-history-lines: 320
  • enkan-repl-tmux-mirror-display-lines: 240
  • enkan-repl-tmux-mirror-max-chars: 256KiB
  • enkan-repl-tmux-mirror-max-line-length: 2048
  • Keep noisy block compaction enabled, with threshold 6 unchanged.

Rationale:

  • 256KiB is still small for full Emacs buffer replacement, and the current design mainly refreshes manually, so the added load should remain bounded.
  • 240 lines should preserve enough surrounding context for longer proposals and answers instead of showing only the middle or tail.
  • A 2048 character line limit avoids crushing normal prose joined by -J, while still bounding pathological single-line output such as minified JSON or huge logs.
  • Large diff/code output remains compacted by the existing noisy block handling.

Implementation plan:

  • Keep the change limited to defcustom defaults and docstring updates.
  • Add tests around prepare-mirror-content so longer prose is not cut at 240 chars and content is still bounded by the 256KiB tail limit.
  • Do not add a separate ignore/file transcript output path in this change. It adds another place to inspect and overlaps with the existing bounded mirror view.

@phasetr
Copy link
Copy Markdown
Owner Author

phasetr commented May 13, 2026

Implementation note

I followed a TDD flow.

Red:

  • test-enkan-repl-tmux-mirror-default-limits
  • test-enkan-repl--terminal-tmux--prepare-mirror-content-keeps-proposal-defaults
  • test-enkan-repl--terminal-tmux--prepare-mirror-content-keeps-joined-prose

Green:

  • enkan-repl-tmux-mirror-history-lines: 320
  • enkan-repl-tmux-mirror-display-lines: 240
  • enkan-repl-tmux-mirror-max-chars: 256 KiB
  • enkan-repl-tmux-mirror-max-line-length: 2048
  • Documented the new defaults in README.

Verification:

  • make test passed: 262/262
  • make compile passed
  • make checkdoc passed
  • git diff --check passed

Commit: a3ae88a

@phasetr phasetr marked this pull request as ready for review May 13, 2026 10:23
@phasetr phasetr merged commit 066f7e5 into main May 13, 2026
1 check passed
@phasetr phasetr deleted the feat/tune-buffer-output-limit branch May 13, 2026 10:23
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 0.19.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant